home *** CD-ROM | disk | FTP | other *** search
- /*
- ** Apple Macintosh Developer Technical Support
- **
- ** Header file for collection of String Utilities for DTS Sample code
- **
- ** Copyright © 1988-1992 Apple Computer, Inc.
- ** All rights reserved.
- */
-
-
- #ifndef __STRINGUTILS__
- #define __STRINGUTILS__
-
- #ifdef applec
-
- #ifndef __TYPES__
- #include <Types.h>
- #endif
-
- #endif
-
-
- /* These are duplicates of c-library functions. The reason for duplicating them
- ** is so that the StringUtils code can be small and linked in with other code that
- ** stays resident at all times. It is possible that when you call code to do
- ** something as seemingly innocent as getting the length of a string, memory can
- ** move. This is because the code you are calling isn't necessarily in memory.
- ** If the code segment that contains the code you are calling isn't in ram, then
- ** it has to be loaded. Loading the code may cause memory compaction, and therefore
- ** memory can move. The pointer to the string is already pushed on the stack prior
- ** to the call, so if you passed a pointer into an unlocked handle, after calling
- ** the code, that handle may have moved, and therefore the pointer is invalid.
- **
- ** To prevent the above problem, alternate names were used for these common library
- ** functions. Link this code into the same segment that holds main(), and you will
- ** be guaranteed that they will be in memory whenever you call them. */
-
- short clen(char *cptr);
- char *ccat(char *s1, char *s2);
- char *ccpy(char *s1, char *s2);
- void pcat(StringPtr d, StringPtr s);
- void pcpy(StringPtr d, StringPtr s);
-
- void c2p(char *cptr);
- void p2c(StringPtr cptr);
-
-
- /*****************************************************************************/
-
- /* These are useful, relatively small routines for string manipulation. As with the
- ** above calls, link them into the code segment that holds main().
- **
- ** With the below functions, you will have most of the functionality of sprintf
- ** using shorts and longs. It will take more calls, but only what you call is linked
- ** in. */
-
-
- /**/
-
- void ccatchr(char *cptr, char c, short count);
- void ccatdec(char *cptr, long v);
- void ccathex(char *cptr, char padChr, short minApnd, short maxApnd, long v);
- void ccatnum(char *cptr, long v, short base);
-
- void ccpychr(char *cptr, char c, short count);
- void ccpydec(char *cptr, long v);
- void ccpyhex(char *cptr, char padChr, short minApnd, short maxApnd, long v);
- void ccpynum(char *cptr, long v, short base);
-
- long c2dec(char *cptr, short *charsUsed);
- long c2hex(char *cptr, short *charsUsed);
- long c2num(char *cptr, short base, short *charsUsed);
-
- /**/
-
- void pcatchr(StringPtr pptr, char c, short count);
- void pcatdec(StringPtr pptr, long v);
- void pcathex(StringPtr pptr, char padChr, short minApnd, short maxApnd, long v);
- long pcatnum(StringPtr pptr, long v, short base);
-
- void pcpychr(StringPtr pptr, char c, short count);
- void pcpydec(StringPtr pptr, long v);
- void pcpyhex(StringPtr pptr, char padChr, short minApnd, short maxApnd, long v);
- void pcpynum(StringPtr pptr, long v, short base);
-
- long p2dec(StringPtr pptr, short *charsUsed);
- long p2hex(StringPtr pptr, short *charsUsed);
- long p2num(StringPtr pptr, short base, short *charsUsed);
-
- /**/
-
- short GetHexByte(char *cptr);
-
- #endif __STRINGUTILS__
-
-
-
-